package nongchang.kuaijiecaifu.com.ncapp_android.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.mobsandgeeks.saripaar.annotation.NotEmpty;
import com.mobsandgeeks.saripaar.annotation.Order;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import ezy.lite.util.DateTime;
import ezy.lite.util.Param;
import ezy.lite.util.UI;
import ezy.widget.view.LabelEditText;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.activity.BaseActivity;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.event.AddressEvent;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Address;
import nongchang.kuaijiecaifu.com.ncapp_android.util.RxBus;
import nongchang.kuaijiecaifu.com.ncapp_android.util.validator.DefaultValidator;
import pickerview.OptionsPickerView;

public class UserChangeSelectAddressActivity extends BaseActivity {
    @Order(1)
    @NotEmpty(message = "姓名不能为空")
    @BindView(R.id.txt_name)
    LabelEditText txtName;
    @Order(2)
    @NotEmpty(message = "手机号不能为空")
    @BindView(R.id.txt_phone)
    LabelEditText txtPhone;
    @Order(3)
    @NotEmpty(message = "地区不能为空")
    @BindView(R.id.txt_area)
    LabelEditText txt_area;
    @Order(4)
    @NotEmpty(message = "详细地址不能为空")
    @BindView(R.id.edit_address)
    EditText edit_address;
    @BindView(R.id.btn_save)
    TextView btnSave;
    DefaultValidator validator;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_change_select_address);
        ButterKnife.bind(this);
        Address item = Param.get(getIntent().getExtras());
        if(item!=null) {
            txtName.setText(item.name);
            txtPhone.setText(item.phone);
            txt_area.setText(item.area);
            edit_address.setText(item.address);
        }
        validator = new DefaultValidator(this);
        validator.clicked(btnSave);
        validator.succeeded(()->{
            finish();
        });
    }

    @OnClick({ R.id.btn_back})
    void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_back:
                finish();
                break;
        }
    }
}
